package bdz.projects.cbt.core
{
	public dynamic class ProductCollection extends Array
	{
		public var alias:String;
		public function ProductCollection(al:String)	{
			alias = al;
			super();
		}
		public function get name():String{
			return alias;
		}
		public function get quantity():Number{
			return length;
		}
		public function get totalPrice():Number{
			return averagePrice*length;
		}
		public function get averagePrice():Number{
			var _total:Number = 0;
			for each(var p:CBTProduct in this){
				_total += p.currentPrice;
			}
			return Math.ceil(_total/length);
		}
		public function addProduct(p:CBTProduct):void{
			push(p);
		}
	}
}